﻿using System;
using EasyDapr.Infrastructure.EfCore;
using InventoryService.Domain.Model;
using Microsoft.EntityFrameworkCore;

namespace InventoryService.Infrastructure.Data
{
    public class MainDbContextDesignFactory : DbContextDesignFactoryBase<MainDbContext>
    {
    }

    public class MainDbContext : AppDbContextBase<string>
    {
        private const string Schema = "inventory";

        public MainDbContext(DbContextOptions options) : base(options)
        {
        }

        public DbSet<Inventory> Inventories { get; set; } = default!;

        protected override void OnModelCreating(ModelBuilder modelBuilder)
        {
            modelBuilder.Entity<Inventory>()
                .ToTable("inventories")
                .Ignore(x => x.DomainEvents);
        }
    }
}